//
//  ReadCollectionViewCell.m
//  Pianke
//
//  Created by BetaTheta on 16/1/19.
//  Copyright © 2016年 BetaTheta. All rights reserved.
//

#import "ReadCollectionViewCell.h"

@implementation ReadCollectionViewCell
// 内存管理
- (void)dealloc
{
    [_coverImg release];
    [_titleLabel release];
    [_eTitleLabel release];
    [super dealloc];
}

// 初始化
- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        // coverImg
        self.coverImg = [[UIImageView alloc] init];
        _coverImg.backgroundColor = [UIColor yellowColor];
        [self.contentView addSubview:_coverImg];
        [_coverImg release];
        
        // title
        self.titleLabel = [[UILabel alloc] init];
        _titleLabel.backgroundColor = [UIColor redColor];
        [self.coverImg addSubview:_titleLabel];
        [_titleLabel release];
        
        // eTitleLabel
        self.eTitleLabel = [[UILabel alloc] init];
        _eTitleLabel.backgroundColor = [UIColor blueColor];
        [self.coverImg addSubview:_eTitleLabel];
        [_eTitleLabel release];
        
    }
    return self;
}
// 布局方法
- (void)applyLayoutAttributes:(UICollectionViewLayoutAttributes *)layoutAttributes
{
    _coverImg.frame = CGRectMake(0, 0, layoutAttributes.size.width, layoutAttributes.size.height);
    _titleLabel.frame = CGRectMake(5, layoutAttributes.size.height - 15, layoutAttributes.size.width - 60, 15);
    _eTitleLabel.frame = CGRectMake(layoutAttributes.size.width - 60, layoutAttributes.size.height - 15, 40, 15);
}
@end
